<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>这是h1</h1>
<div>这是div</div>
<script>
    //通过选择器得到元素对象
    let h = document.querySelector("h1");
    //修改元素的文本内容
    h.innerText = "内容被改掉了!";
    //创建元素对象
    let img = document.createElement("img");
    img.src = "a.png";
    //添加到body里面
    document.body.append(img);
</script>
</body>
</html>